import 'package:flutter/material.dart';
import 'package:flutter/services.dart';


void main()=>runApp(
    MaterialApp(
      home: Scaffold(
        body: MyApp(),
      ),
      theme: ThemeData(
        primarySwatch: Colors.yellow,
        textTheme: TextTheme(),
        buttonTheme: ButtonThemeData(buttonColor: Colors.yellow),
      ),
    )
);

class MyApp extends StatefulWidget {
  TextEditingController _unameController = TextEditingController();

  @override
  State<StatefulWidget> createState() {
    return _MyAppState();
  }

}

class _MyAppState extends State<MyApp> {

  @override
  Widget build(BuildContext context) {
    return Column(
      mainAxisAlignment: MainAxisAlignment.center,
      children: <Widget>[
        TextField(
          //是否自动获取焦点
          autofocus: false,
          //正在编辑的文本样式。
          style:TextStyle(color: Colors.yellow),
          //输入框的最大行数，默认为1
          maxLines:1,
          //输入框文本的最大长度
          maxLength:6,
          //文本长度超过maxLength时如何处理
          maxLengthEnforcement:MaxLengthEnforcement.enforced,
          controller: widget._unameController,
          textInputAction: TextInputAction.next,
          toolbarOptions:ToolbarOptions(
            copy:true,
            cut:true,
            paste:true,
            selectAll:true,
          ),
          decoration: InputDecoration(
            // labelText: "用户名",
              hintText: "用户名或邮箱",
              hintStyle: TextStyle(color: Colors.black12),
              prefixIcon: Icon(Icons.person)
          ),
        ),
        TextField(
          textInputAction: TextInputAction.done,
          decoration: InputDecoration(
              labelText: "密码",
              hintText: "您的登录密码",
              prefixIcon: Icon(Icons.lock)
          ),
          //是否隐藏正在编辑的文本
          obscureText: true,
        ),
      ],
    );
  }
}







